package com.ck.chuangke.service;

import java.io.IOException;
import java.rmi.ServerException;
import java.util.List;
import java.util.Map;

import org.springframework.web.multipart.MultipartFile;

import com.ck.model.chuangke.vo.CkDeviceUpgradeListVO;
import com.ck.model.chuangke.vo.CkDeviceUpgradeVO;
import com.ck.model.common.DeviceUpgrade;
import com.ck.model.common.User;
import com.ck.model.common.page.PageInfo;

/**
 * 终端升级Service
 */
public interface CkUpgradeService {
	
	/**
	 * 通过对应机型获取终端升级
	 * getDeviceUpgradeByModel
	 *
	 * @param model 对应机型
	 * @return DeviceUpgrade
	 */
	DeviceUpgrade getDeviceUpgradeByModel(String model);

	/**
	 * 保存终端升级
	 *
     * @param deviceUpgrade deviceUpgrade对象
     * @param user
     * @param operationIp
     */
	void saveDeviceUpgrade(DeviceUpgrade deviceUpgrade, User user, String operationIp);

	/**
	 * 获取终端升级分页列表
	 *
	 * @param upgradeType 固件或apk
	 * @return Page<CkDeviceUpgradeListVO>
	 */
	PageInfo<CkDeviceUpgradeListVO> listDeviceUpgradeByPage(Integer upgradeType, Integer pageNum, Integer pageSize);

	/**
	 * 获取所有版本号
	 * @return  List<String>
	 */
	List<String> listAllVersionCode();

	/**
	 * 获取所有版本号
	 * @return  List<String>
	 */
	List<String> listAllVersionName();

	/**
	 * 通过ID获取终端升级
	 *
	 * @param deviceUpgradeId 终端升级ID
	 * @return DeviceUpgrade
	 */
	DeviceUpgrade getDeviceUpgradeById(Long deviceUpgradeId) throws ServerException;

	/**
	 * 更新终端升级
	 *
	 * @param deviceUpgrade DeviceUpgrade
	 * @param request operationIp
	 */
	void updateDeviceUpgrade(DeviceUpgrade deviceUpgrade,User user, String operationIp) throws ServerException;

	/**
	 * 根据主键查询
	 *
	 * @param deviceUpgradeId 主键
	 * @return DeviceUpgradeVO
	 */
    CkDeviceUpgradeVO getDeviceUpgradeByIdVo(Long deviceUpgradeId);
    
    /**
	 *  保存apk文件
	 * @param file  MultipartFile
	 * @throws IOException
	 */
	Map<Object, Object> saveApkFile(MultipartFile file) throws IOException;
	
	/**
	 * 保存固件文件名
	 * @param files
	 * @return
	 */
    Map<Object,Object> saveFirmwareFile(MultipartFile files) throws IOException;
}
